<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">

{{ partial "head.html" . }}
<link rel="stylesheet" href="{{ "css/blog.css" | relURL}}?t={{ mul 1000 (time now).Unix }}">
{{ partial "head.html" . }}
{{$lan := index (split .URL "/") 1 }}
{{if ne $lan "zh-cn"}}
{{$lan = "" }}
{{else}}
{{$lan = "zh-cn/" }}
{{end}}

<body>

    <div id="all">

        <header>

            {{ partial "nav.html" . }}

        </header>
        <div class="nav-mask hide"></div>
        <div class="blog-mask hide"></div>
        <div class="tag-filter">
            <div class="tag-filter-header">
                <div class="header-left">
                    <img style="height:16px; width: 16px;" src="../img/blogs/Filter_Black.svg" alt="">
                    <span>{{ i18n "MAIN_POSTBLOG_FILTER"}}</span>
                </div>
                <div  class="header-right">
                    <a style="color:rgba(0,0,0,1);line-height:26px;" href={{ i18n "BLOG_LINK"}} >
                    <img style="height:16px; width: 16px;" src="../img/blogs/Post_Black.svg" alt="">
                    <span>{{ i18n "MAIN_POSTBLOG_SOURCE"}}</span>
                </a>
                </div>
            </div>
            <div class="tag-filter-content hide">
                <p>{{ i18n "SIDEBAR_TAG" }}</p>
                <ul>
                    {{ range $name, $items := .Site.Taxonomies.tags }}
                        <a href="{{ $.Site.BaseURL }}{{$lan}}tags/{{ $name | urlize }}.html"> {{ $name }}</a>
                        {{ end }}
                </ul>
            </div>
        </div>
        <div id="content">
            <div class="container">
                <div class="row">
                    <!-- *** LEFT COLUMN *** -->

                    <h1 class="blog-post">{{ i18n "BLOG_TITLE" }}</h1>

                    <div class="col-md-9" id="blog-listing-medium">

                        {{ $paginator := .Paginate (where .Data.Pages "Type" "blog") }}
                        {{ range $paginator.Pages }}
                        <section class="post">
                            <div class="row">
                                <div class="col-md-12 fontHuaweiSans">
                                    <h3><a class="fz16" href="{{ .Permalink }}" target="_blank">{{ .Title }}</a></h3>
                                    <div class="clearfix fontRoboto">
                                        <p class="author fz12">
                                            {{ if isset .Params "author" }}
                                            <span>{{ .Params.author }}</span>
                                            {{ end }}
                                        </p>
                                        {{ if isset .Params "date" }}
                                        <p class="date-comments fz12">
                                            <span class="character fz12">|</span>
                                            <span> {{ .Date.Format .Site.Params.date_format }}</span>
                                            <span class="character fz12">|</span>
                                        </p>
                                        {{ end }}
                                        <p class="tags">
                                            {{ if isset .Params "tags" }}
                                            {{ if gt (len .Params.tags) 0 }}
                                            {{ range .Params.tags }}
                                            <a class="fz12"
                                            href="{{ $.Site.BaseURL }}{{$lan}}tags/{{ . | urlize }}.html">{{ . }}</a>
                                            {{ end }}
                                            {{ end }}
                                            {{ end }}
                                        </p>
                                    </div>
                                    <p class="intro fz14">{{ .Summary }}</p>
                                    <p class="read-more"><a href="{{ .Permalink }}"class="view-more" target="_blank">{{ i18n "MAIN_LIST_MORE" }}</a>
                                    </p>
                                </div>
                            </div>
                        </section>
                        {{ end }}

                        <!-- <ul class="pager">
                            {{ if .Paginator.HasPrev }}
                            <li class="previous"><a href="{{ .Site.BaseURL }}{{ .Paginator.Prev.URL }}">&larr; {{ i18n "newer" }}</a></li>
                            {{ else }}
                            <li class="previous disabled"><a href="javaScript:;">&larr; {{ i18n "newer" }}</a></li>
                            {{ end }}

                            {{ if .Paginator.HasNext }}
                            <li class="next"><a href="{{ .Site.BaseURL }}{{ .Paginator.Next.URL }}">{{ i18n "older" }} &rarr;</a></li>
                            {{ else }}
                            <li class="next disabled"><a href="javaScript:;">{{ i18n "older" }} &rarr;</a></li>
                            {{ end }}
                        </ul> -->

                        <!-- 分页开始 -->
                        
                        {{ $pag := $.Paginator }}
                        {{ if  gt $pag.TotalPages 1}}
                        <ul class="pagination">
                            {{ if $pag.HasPrev }}
                                <li><a class='page-number' href="{{ $pag.Prev.URL }}">&larr; {{ i18n "newer" }}</a></li>
                            {{ end }}
                            
                            {{ $ellipsed := false }}
                            {{ $showldEllipse := false }}
                            {{ range $pag.Pagers }}
                                {{ $right := sub .TotalPages .PageNumber }}
                                {{ $showNumber := or (le .PageNumber  3) (eq $right 0) }}
                                {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2)))  }}

                                {{ if $showNumber }}
                                        {{ $ellipsed = false }}
                                        {{ $showldEllipse = false }}
                                    {{ else }} 
                                        {{ $showldEllipse = not $ellipsed }}
                                        {{ $ellipsed = true }}
                                {{ end }}

                                {{ if $showNumber }}
                                <li class="{{ if eq . $pag }} active {{ end }}"><a class="page-number " href='{{ .URL }}'>{{ .PageNumber }}</a></li>
                                    {{ else if $showldEllipse }}
                                    <span class="space">&nbsp;&hellip;&nbsp;</span>
                                {{end}} 
                            {{end}} 
                            {{ if $pag.HasNext }}
                            <li><a class="page-number" href='{{ $pag.Next.URL }}'>{{ i18n "older" }} &rarr;</a></li>
                            {{ end }} 
                        </ul>
                        {{ end }}
                        <!-- 分页结束 -->

                    </div>
                    <!-- /.col-md-9 -->

                    <!-- *** LEFT COLUMN END *** -->

                    <!-- *** RIGHT COLUMN ***
       _________________________________________________________ -->

                    <div class="col-md-3">

                        <!-- *** MENUS AND WIDGETS *** -->
                        {{ partial "sidebar.html" . }}

                        <!-- *** MENUS AND FILTERS END *** -->

                    </div>
                    <!-- /.col-md-3 -->

                    <!-- *** RIGHT COLUMN END *** -->

                </div>
                <!-- /.row -->
            </div>
            <!-- /.container -->
        </div>
        <!-- /#content -->

        {{ partial "footer.html" . }}

    </div>
    <!-- /#all -->

    {{ partial "scripts.html" . }}
    <script src="{{ "js/blog.js" | relURL }}?t={{ mul 1000 (time now).Unix }}"></script>

</body>

</html>
